package com.wanban.m3u8download

import com.wanban.download.db.DownloadEntity
import com.wanban.download.model.DownloadType
import com.wanban.download.model.Status

object DataUtils {

    private val urls = arrayOf(
        UrlData("花桥喜事","https://s9.fsvod1.com/20230830/q6INDNEY/index.m3u8", 9, 7),
        UrlData("时光正好","https://m3u.haiwaikan.com/xm3u8/bdf487606d4104b11ce62adc04021a2bfd094caaf92b99d4bb549a8a0c6e11069921f11e97d0da21.m3u8", 1,1),
        // 二次请求
        UrlData("时光正好","https://s10.fsvod1.com/20240603/5hHInFCf/index.m3u8", 9,1),
        // 有秘钥
        UrlData("时光正好","https://play.xluuss.com/play/mbkv9L6a/index.m3u8", 20,2),
        UrlData("时光正好","https://hd.ijycnd.com/play/YerDyopb/index.m3u8", 19,3),
        UrlData("时光正好","https://v8.fentvoss.com/sdv8/202406/03/vDBmebRNxY14/video/index.m3u8", 10,3),
        UrlData("时光正好","https://v.gsuus.com/play/YerDyPWb/index.m3u8", 18,4),
        UrlData("时光正好","https://v4.longshengtea.com/yyv4/202406/05/AZwZBtiXg74/video/index.m3u8", 16,5),
        UrlData("时光正好","https://play.subokk.com/play/7e5Pynqd/index.m3u8", 15,6),
        UrlData("时光正好","https://v.cdnlz12.com/20240604/14961_97c9c49f/index.m3u8", 13,6),
        UrlData("时光正好","https://1080p.huyall.com/play/Rb4O800a/index.m3u8", 11,7),
        UrlData("时光正好","https://vv.jisuzyv.com/play/QeZ14QEd/index.m3u8", 8,8),
        UrlData("时光正好","https://svipsvip.ffzy-online5.com/20240605/28222_b84b00d0/index.m3u8", 7,8),
        UrlData("时光正好","https://v10.dious.cc/20240605/94n6nVAA/index.m3u8", 6,8),
        UrlData("时光正好","https://v4.mzxay.com/202406/05/AZwZBtiXg74/video/index.m3u8", 5,8),
        UrlData("时光正好","https://hn.bfvvs.com/play/PdRNgG0d/index.m3u8", 4,8),
        UrlData("时光正好","https://v4.daayee.com/yyv4/202406/05/AZwZBtiXg74/video/index.m3u8", 3,8),
        UrlData("时光正好","https://v7.tlkqc.com/wjv7/202406/05/aDj4Af4MzH79/video/index.m3u8", 2,8),
        UrlData("时光正好","https://v4.xingchongwang.com/yyv4/202406/05/AZwZBtiXg74/video/index.m3u8", 42,8),
        UrlData("时光正好","https://ukzy.ukubf4.com/20240604/pKgLlqLS/index.m3u8", 12,8),
        UrlData("时光正好","https://v4.bxgbnet.com/sdv4/202406/05/AZwZBtiXg74/video/index.m3u8", 40,8),
        UrlData("时光正好","https://s3.bfengbf.com/video/shiguangzhenghao/第08集/index.m3u8", 38,8),
        UrlData("时光正好","https://ikcdn01.ikzybf.com/20240605/DIGoPXZq/index.m3u8", 34,8),
        UrlData("时光正好","https://play.hhuus.com/play/QbY86P9a/index.m3u8", 32,8),
        UrlData("时光正好","https://vod.lyhuicheng.com/20240604/D3wj6soN/index.m3u8", 39,8),
        UrlData("时光正好","https://vip.kuaikan-play1.com/20240605/3UZW1lDb/index.m3u8", 37,8),
        UrlData("时光正好","https://m3u.hw8.live/share/618bef6b8ef14d739bdeda4c9918b0e3.m3u8", 35,8),
        UrlData("时光正好","https://cdn.wlcdn99.com:777/963ba836/index.m3u8", 33,8),


    )

    fun getDownloads(): ArrayList<DownloadEntity> {
        val tasks = ArrayList<DownloadEntity>()
        val videoIdStartIndex = 1000L
        urls.forEachIndexed { index, data ->
            val item = DownloadEntity(data.url, data.videoName)
            // 新建下载任务
            item.videoId = videoIdStartIndex + index
            item.sourceId = data.sourceId
            item.episode = data.episode
            item.state = Status.IDLE
            item.downloadType = DownloadType.MEDIA3
            // 下载
            tasks.add(item)
        }
        return tasks
    }

    class UrlData(
        val videoName: String,
        val url: String,
        val sourceId: Int,
        val episode: Int
    )

}